/**
 * @description 返回当前微生物
 * @param {number} num 0,1,2
 * @returns {string}  优 ｜ 良 ｜ 差
 */
export const germFilter = (num: number) => {
  console.log(num, 'num==========')
  if (num == undefined) return '--'
  const list = [
    { text: '优', value: 0 },
    { text: '良', value: 1 },
    { text: '差', value: 2 }
  ]

  return list[num].text
}
/**
 * @description 返回当前模式
 * @param {number} num 0,1,2
 * @returns {string} 智能 ｜ 手动 ｜ 程控
 */
export const modeFilter = (num: number) => {
  const list = [
    { text: '智能', value: 0 },
    { text: '手动', value: 1 },
    { text: '程控', value: 2 }
  ]

  return list[num].text
}

/**
 * @description 返回故障详情
 * @param {string} num 0,1,2,3,5 0=正常
 * @returns {object}
 */
export const faultFilter = (num: number) => {
  const list: { [key: number]: object } = {
    1: {
      description: '送风等离子故障，请点击下方按钮手动报修',
      btnText: '上报故障',
      id: 1,
      code: 'E1'
    },
    2: {
      description: '排风等离子故障，请点击下方按钮手动报修',
      btnText: '上报故障',
      id: 2,
      code: 'E2'
    },
    3: { description: '空调机组系统故障，请联系售后服务', btnText: '我知道了', id: 3, code: 'E3' },
    5: { description: '耗材提醒滤网堵塞！请及时处理', btnText: '我知道了', id: 5, code: 'E5' }
  }

  return list[num]
}

/**
 * @description 机组页面状态显示
 * bit0:正压 00000001 1
 * bit1:负压 00000010 2
 * bit2:新风 00000100 4
 * bit3:自定义1 00001000 8
 * bit4:自定义2 00010000 16
 * bit5:自定义3 00100000 32
 * @param num
 */
export const statusFilter = (num: number) => {
  const list: { [key: number]: string } = {
    1: '正压',
    2: '负压',
    4: '新风',
    8: '自定义1',
    16: '自定义2',
    32: '自定义3'
  }

  return list[num]
}

/**
 * @description 机组页面模式显示
 * bit0:制冷 00000001 1
 * bit1:制热 00000010 2
 * bit2:送风 00000100 4
 */
export const unitModeFilter = (num: number) => {
  const list: { [key: number]: string } = {
    1: '制冷',
    2: '制热',
    4: '送风'
  }

  return list[num]
}
